class Team < ActiveRecord::Base
  validates_presence_of :name,:sport_id
  validates_uniqueness_of :name
  belongs_to :sport

  def pic
    pic = read_attribute :pic
    if pic.blank?
      "team_no_pic.png"
    else
      pic
    end
  end
  def displayed_name
    if self.display_name.to_s.size>0
      self.display_name
    else
      self.name
    end 
  end
end
